import { DataSource } from 'typeorm'

import shopGoldEntiry from '../entity/shopGold.js'
import bankGoldEntiry from '../entity/bankGold.js'

export const dataSource = new DataSource({
  type: 'mysql',
  // host: 'localhost',
  host: '10.208.2.25',
  port: 3306,
  username: 'root',
  password: '123456',
  database: 'test_db',
  // 是否将实体同步到数据库
  synchronize: true,
  // 自动加载实体配置， forFeature() 注册的每个实体都自动加载
  // autoLoadEntities: true,
  // 手动加载实体， 这个和上面 autoLoadEntities 用一个就行
  // entities: [PostsEntity],
  // 指定时区
  timezone: '+08:00',
  entities: [shopGoldEntiry, bankGoldEntiry]
})
